/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "roles")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Roles.findAll", query = "SELECT r FROM Roles r"),
    @NamedQuery(name = "Roles.findByIdRoles", query = "SELECT r FROM Roles r WHERE r.idRoles = :idRoles"),
    @NamedQuery(name = "Roles.findByRole", query = "SELECT r FROM Roles r WHERE r.role = :role"),
    @NamedQuery(name = "Roles.findByLogin", query = "SELECT r FROM Roles r WHERE r.login = :login")
})
public class Roles implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_roles")
    private Integer idRoles;
    @Basic(optional = false)
    @Column(name = "role")
    private String role;
    @Basic(optional = false)
    @Column(name = "login")
    private String login;
    @JoinColumn(name = "Utilisateur_idUtilisateur", referencedColumnName = "idUtilisateur")
    @ManyToOne(optional = false)
    private Utilisateur utilisateuridUtilisateur;

    public Roles()
    {
    }

    public Roles(Integer idRoles)
    {
        this.idRoles = idRoles;
    }

    public Roles(Integer idRoles, String role, String login)
    {
        this.idRoles = idRoles;
        this.role = role;
        this.login = login;
    }

    public Integer getIdRoles()
    {
        return idRoles;
    }

    public void setIdRoles(Integer idRoles)
    {
        this.idRoles = idRoles;
    }

    public String getRole()
    {
        return role;
    }

    public void setRole(String role)
    {
        this.role = role;
    }

    public String getLogin()
    {
        return login;
    }

    public void setLogin(String login)
    {
        this.login = login;
    }

    public Utilisateur getUtilisateuridUtilisateur()
    {
        return utilisateuridUtilisateur;
    }

    public void setUtilisateuridUtilisateur(Utilisateur utilisateuridUtilisateur)
    {
        this.utilisateuridUtilisateur = utilisateuridUtilisateur;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idRoles != null ? idRoles.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Roles))
        {
            return false;
        }
        Roles other = (Roles) object;
        if ((this.idRoles == null && other.idRoles != null) || (this.idRoles != null && !this.idRoles.equals(other.idRoles)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Roles[ idRoles=" + idRoles + " ]";
    }
    
}
